Expand description

A crate for talking to J-Link debug probes connected via USB.

This crate allows access to the vendor-specific USB interface used to control JTAG / SWD operations and other functionality. It does not provide access to the virtual COM port functionality (which is a regular CDC device, so no special support is needed).

Inspired by libjaylink (though this library is not a port).

Pinout

J-Link uses a pinout based on the standard 20-pin ARM JTAG connector, extended for SWD compatibility and with pins for UART.

JTAG pinout:

           ┌───────────┐
    VTref  │ *  1  2 * │ NC
    nTRST  │ *  3  4 * │ GND
      TDI  │ *  5  6 * │ GND
      TMS  │ *  7  8 * │ GND
      TCK ┌┘ *  9 10 * │ GND
     RTCK └┐ * 11 12 * │ GND
      TDO  │ * 13 14 * │ GND
    RESET  │ * 15 16 * │ GND
    DBGRQ  │ * 17 18 * │ GND
5V-Supply  │ * 19 20 * │ GND
           └───────────┘

SWD (+ UART) pinout:

           ┌───────────┐
    VTref  │ *  1  2 * │ NC
        -  │ *  3  4 * │ GND
J-Link TX  │ *  5  6 * │ GND
    SWDIO  │ *  7  8 * │ GND
    SWCLK ┌┘ *  9 10 * │ GND
        - └┐ * 11 12 * │ GND
      SWO  │ * 13 14 * │ GND
    RESET  │ * 15 16 * │ GND
J-Link RX  │ * 17 18 * │ GND
5V-Supply  │ * 19 20 * │ GND
           └───────────┘

PIC32 ICSP pinout (untested):

           ┌───────────┐
    VTref  │ *  1  2 * │ NC
        -  │ *  3  4 * │ GND
        -  │ *  5  6 * │ GND
     PGED  │ *  7  8 * │ GND
     PGEC ┌┘ *  9 10 * │ GND
        - └┐ * 11 12 * │ GND
        -  │ * 13 14 * │ GND
    RESET  │ * 15 16 * │ GND
        -  │ * 17 18 * │ GND
5V-Supply  │ * 19 20 * │ GND
           └───────────┘

Reference

Segger has released a PDF documenting the USB protocol: “Reference manual for J-Link USB Protocol” (Document RM08001-R2).

The archive.org version is the most up-to-date one.

Structs

An iterator over a received bit stream.

A set of capabilities advertised by a probe.

The error type used by this library.

A hardware version returned by JayLink::read_hardware_version.

Iterator over supported Interfaces.

A set of supported target interfaces.

A handle to a J-Link USB device.

Target communication speed setting.

J-Link communication speed info.

SWO data that was read via JayLink::swo_read.

Supported SWO capture speed info.

A SWO data stream that implements std::io::Read.

Generic info about a USB device.

Enums

List of capabilities that may be advertised by a probe.

List of specific errors that may occur when using this library.

The hardware/product type of the device.

List of target interfaces.

The supported SWO data encoding modes.

Functions

Scans for J-Link USB devices.

Type Definitions

A result type with the error hardwired to Error.